(deftemplate meniu
	(slot friptura) 	/* porc, vita, pui */
    (slot garnitura)	/* cartofi, orez, paste, legume */
)

(assert (meniu (friptura nil)(garnitura nil)))

(defrule intrebare
	(meniu 
    	(friptura nil)
        (garnitura nil)
    )
    
    =>
    
    (printout t "Ce friptura preferati? (porc, vita, pui)" crlf)
    (bind ?f (read)) 
    
    (printout t "Ce garnitura preferati? (cartofi, orez, paste, legume)" crlf)
    (bind ?g (read))
    
    (assert (meniu (friptura ?f)(garnitura ?g)))   
)

(defrule vin1 
    (declare (salience 0))
	?id<-(meniu 
        	(friptura vita)
    	  )
    
    =>    
    
    (printout t "Se recomanda un vin rosu!")
    (retract ?id)
)

(defrule vin2 
    (declare (salience 0))
	?id<-(meniu 
        	(friptura porc)
    	  )
    
    =>    
    
    (printout t "Se recomanda un vin rosu, tare!")
    (retract ?id)
)

(defrule vin3
    (declare (salience 0))
	?id<-(meniu 
        	(friptura pui)
    	  )
    
    =>    
    
    (printout t "Se recomanda un vin alb!")
    (retract ?id)
)

(defrule vin4
    (declare (salience -1))
	?id<-(meniu 
        	(garnitura orez)
    	  )
    
    =>    
    
    (printout t "Se recomanda un vin alb!")
    (retract ?id)
)

(defrule vin5
    (declare (salience -2))
	?id<-(meniu 
        	(garnitura ?g & ~orez & ~nil)
    	  )
    
    =>    
    
    (printout t "Se recomanda un vin dulce natural!")
    (retract ?id)
)


(run)